<?php
/*
Plugin Name: Word Press Travel Plugin
Plugin URI: http://code.google.com/p/widgetapps-wp-travelplugin/
Description: A Word Press Plugin For Travel Sites
Version: 0.1
Author: Darryl Patterson
Author URI: http://www.pattersons.net
*/

/*
  Copyright 2009  Darryl Patterson  (email : widgetapps@gmail.com)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

register_activation_hook( dirname( __FILE__ ) . '/php/activate.php', 'wptravel_install' );

// Load the plugin class
if ( !class_exists( 'WidgetApps_WpTravel' ) ) {
	require_once( dirname( __FILE__ ) . '/php/WidgetApps/WpTravel.php' );
}
if ( class_exists( 'WidgetApps_WpTravel' ) ) {
	$wa_travel = new WidgetApps_Wptravel(dirname( __FILE__ ));
}

// Load the widget classes
if ( !class_exists( 'WidgetApps_Widget_Date' ) ) {
	require_once( dirname( __FILE__ ) . '/php/WidgetApps/Widget/Date.php' );
}
if ( !class_exists( 'WidgetApps_Widget_Price' ) ) {
	require_once( dirname( __FILE__ ) . '/php/WidgetApps/Widget/Price.php' );
}
if ( class_exists( 'WidgetApps_Widget_Date' ) && class_exists( 'WidgetApps_Widget_Price' ) ) {
	
}

// Add the action and filter hooks

if ( isset( $wa_travel ) ) {
	
	add_action( 'wp_head', array( $wa_travel, 'addHeaderCode' ), 1 );
	add_action( 'widgets_init', array( $wa_travel, 'widgetInit' ), 1 );
	add_action( 'admin_menu', array( $wa_travel, 'pluginAdminMenu' ), 1);
	add_action( 'admin_init', array( $wa_travel, 'registerSettings' ), 1 );
	add_action( 'init', array( $wa_travel, 'init' ), 1 );
	add_action( 'admin_menu', array( $wa_travel, 'addCustomBox' ), 1 );
	add_action( 'save_post', array( $wa_travel, 'savePostData' ), 1 );
	add_action( 'deleted_post', array( $wa_travel, 'deletePostData' ), 1 );
	add_action( 'admin_head', array( $wa_travel, 'adminCss' ), 1 );
	add_action( 'parse_query', array( $wa_travel, 'processSearch' ), 1 );
	
	add_filter( 'rewrite_rules_array', array( $wa_travel, 'addRewriteRule' ), 1 );
	add_filter( 'query_vars', array( $wa_travel, 'addQueryVars' ), 1 );
	add_filter( 'the_content', array( $wa_travel, 'processContent' ), 1 );
	
}

// TODO: Post expires after end date
// TODO: Pre-pop the info box for the [contact-form]
// TODO: Need to search by date, have calendar
// TODO: Maybe add a "contact us" link beside each date?
